package cn.findviewbydream.evil.main.enums;

/********************************************
 * 工程名：HebeuCS
 * 包名：cn.findviewbydream.evil.main.enums
 * 时间：16-11-14
 * 作者：白雨濃 evil
 * 邮箱：evilbai@foxmail.com
 * 内容：新贴发布状态
 ********************************************/
public enum ReleaseNewpostType
{
    SUCCESS(1, "发布成功！"),
    FAIL_NOUSER(-1, "用户登录过期，请重新登录！"),
    FAIL_TOMUCH(-2, "您的发布次数过于频繁，请稍后再试！"),
    ERROR(-3, "发生错误！");

    private int index;
    private String state;

    ReleaseNewpostType(int index, String state)
    {
        this.index = index;
        this.state = state;
    }

    public static String getState(int index)
    {
        for (ReleaseNewpostType typeEnum : ReleaseNewpostType.values())
            if (typeEnum.getIndex() == index)
                return typeEnum.state;
        return null;
    }

    public int getIndex()
    {
        return index;
    }

    public void setIndex(int index)
    {
        this.index = index;
    }

    public String getState()
    {
        return state;
    }

    public void setState(String state)
    {
        this.state = state;
    }

    @Override
    public String toString()
    {
        return index + "=" + state;
    }
}
